/**
 * 
 */
package com.lanswon.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lanswon.common.enums.ArticleStatus;
import com.lanswon.dao.ActivityMapper;
import com.lanswon.dao.ArticleMapper;
import com.lanswon.entity.Activity;
import com.lanswon.entity.ArticleVO;

/**
 * @author lanswon
 *
 */
@Service
public class ActivityService {
	@Autowired
	private ActivityMapper activityMapper;

	/**
	 * 列表查询
	 * @return
	 */
	public List<Activity> pageList(Map<String, Object> map){
		return activityMapper.selectActivityPageList(map);
	}

	public Activity findArticleById(Long id) {
		return activityMapper.selectByPrimaryKey(id);
	}

	/**
	 * 查询列表数量
	 * @param map
	 */
	public Integer pageListCount(Map<String, Object> map) {
		return activityMapper.selectPageListCount(map);
	}

	public void updateArticle(Activity activity) {
		activity.setUpdateTime(new Date());
		activityMapper.updateByPrimaryKeySelective(activity);
	}

	public void addArticle(Activity activity) {
		Date d = new Date();
		activity.setCreateTime(d);
		activity.setUpdateTime(d);
		activityMapper.insert(activity);
	}

	public void deleteActivity(Long id) {
		activityMapper.deleteByPrimaryKey(id);
	}

	
}
